package com.example.yangchunxi2022090658

import android.content.Intent
import android.os.Bundle
import com.google.android.material.snackbar.Snackbar
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.navigateUp
import androidx.navigation.ui.setupActionBarWithNavController
import com.example.yangchunxi2022090658.databinding.ActivityAddStudentBinding
import com.google.gson.Gson

class addStudent : AppCompatActivity() {

    private lateinit var appBarConfiguration: AppBarConfiguration
    private lateinit var binding: ActivityAddStudentBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val param:String = intent.getStringExtra("name")?: "参数错误"
        binding = ActivityAddStudentBinding.inflate(layoutInflater)
        setContentView(binding.root)
        binding.button4.setOnClickListener{

            setResult(RESULT_OK, Intent().putExtra("result", Gson().toJson(Stu(binding.textInputLayout2.editText?.text.toString(),binding.textInputLayout3.editText?.text.toString(),binding.textInputLayout4.editText?.text.toString(),binding.textInputLayout5.editText?.text.toString()))))
            finish()
        }
    }

}